<h1>Payslip</h1>

<?php
    $this->headTitle('Payslip');
    $acl = $this->acl;    
?>

<?php if ($acl->isAllowed($this->currentUser, 'access finance pages')): ?>
<a href="<?php echo $this->url(
    array(
        'module' => 'finance',
        'controller' => 'index',
        'action' => 'index',
    ), 'default', true
);?>">Finance</a> |
<?php endif; ?>

<?php if ($acl->isAllowed($this->currentUser, 'access finance pages')): ?>
<a href="<?php echo $this->url(
    array(
        'module' => 'finance',
        'controller' => 'payslip',
        'action' => 'create',
    ), 'default', true
);?>">Create</a> |
<?php endif; ?>

<?php if ($acl->isAllowed($this->currentUser, 'access finance pages')): ?>
<a href="<?php echo $this->url(
    array(
        'module' => 'finance',
        'controller' => 'payslip',
        'action' => 'settings',
    ), 'default', true
);?>">Settings</a>
<?php endif; ?>


<?php if (count($this->paginator)): ?>

<table class="data_table">
    <tr>
        <th>Employee E-mail<?php echo $this->sortButtons("email"); ?></th>
        <th>Date<?php echo $this->sortButtons("date"); ?></th>
        <th>Action</th>
    </tr>
    
<?php foreach ($this->paginator as $item): ?>
<?php
    $item = $item->toArray();
?>
    <tr>
         <td><?php echo $this->userHyperlink(
                            $this->escape($item['employee_id'])); ?></td>
        <td><?php echo $this->timestampToHuman(
                            $this->escape($item['date'])); ?></td>
        <td><a href="<?php echo $this->url(array(
                'module'        =>  'finance', 
                'controller'    =>  'payslip', 
                'action'        =>  'viewdetails',
                'payslip_id' => $this->escape($item['payslip_id'])
                )); ?>">Details</a>
                
    </tr>
<?php endforeach; ?>
</table>

<?php endif; ?>


<div class="pagination">
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'search.phtml'); ?>
</div>
<div class="div_clear"></div>


